<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="../../plugins/element-ui/index.css" />
    <link rel="stylesheet" href="../../styles/common.css" />
    <link rel="stylesheet" href="../../styles/page.css" />
    <style>
        #judge-app  .notAdmin::after{
            border: 0 !important;

        }
    </style>
    <style scoped>
        fieldset {

            /* 表单页面居中，宽度50% ,legend颜色设置，legend圆角*/
            border:2px solid #DCDFE6;  text-align:left; border-radius: 8px;margin: 0 auto;width:50%;
        }
    </style>
</head>
<body>
<div class="addBrand-container" id="judge-app">
    <div class="container">
        <fieldset>
        <el-form
                ref="ruleForm"
                :model="ruleForm"
                :rules="rules"
                :inline="false"
                label-width="180px"
                class="demo-ruleForm"
                label-position="top"
        >
            <el-form-item
                    label="1.对于当前老师的教学方法请你做出评价（符合的打勾）:"
                    prop="teachingCheckList"
            >
                <el-checkbox-group v-model="ruleForm.teachingCheckList">
                    <el-checkbox label="教学方法能够激发学生的学习兴趣，提高他们的学习积极性。"></el-checkbox>
                    <el-checkbox label="教学方法能够有效地传授知识，帮助学生理解并掌握学习内容。"></el-checkbox>
                    <el-checkbox label="教学方法能够培养学生的思维能力和创新能力，促进学生的全面发展。"></el-checkbox>
                    <el-checkbox label="教学方法是否能够有效地评估学生的学习成果，提供及时的反馈和指导。"></el-checkbox>
                    <el-checkbox label="教学方法是否能够适应不同的学生需求，满足个性化教学的要求。"></el-checkbox>
                </el-checkbox-group>
            </el-form-item>

            <el-form-item
                    label="2.对于当前老师的课堂互动请你做出评价（符合的打勾）:"
                    prop="classroomCheckList"
            >
                <el-checkbox-group v-model="ruleForm.classroomCheckList">
                    <el-checkbox label="课堂互动能够鼓励学生积极参与，提高他们的参与度和表达能力。"></el-checkbox>
                    <el-checkbox label="课堂互动能够促进师生之间的交流和合作，建立良好的师生关系。"></el-checkbox>
                    <el-checkbox label="课堂互动能够激发学生的思考和探究能力，促进学生对学习内容的深入理解和掌握。"></el-checkbox>
                    <el-checkbox label="课堂互动能够及时解决学生的问题和困惑，提供有效的指导和帮助。"></el-checkbox>
                    <el-checkbox label="课堂互动能够创造一个积极、开放、包容的学习氛围，培养学生的创新精神和合作意识。"></el-checkbox>
                </el-checkbox-group>
            </el-form-item>

            <el-form-item
                    label="3.对于当前老师的学生反馈请你做出评价（符合的打勾）:"
                    prop="studentCheckList"
            >
                <el-checkbox-group v-model="ruleForm.studentCheckList">
                    <el-checkbox label="学生是否能够明确表达对教学方法和课堂互动的意见和建议。"></el-checkbox>
                    <el-checkbox label="学生是否能够提供具体、客观的反馈，指出教学方法和课堂互动的优点和不足。"></el-checkbox>
                    <el-checkbox label="学生是否能够提供改进教学方法和课堂互动的建议，提出创新性的想法和方案。"></el-checkbox>
                    <el-checkbox label="学生是否能够理解并接受教师对反馈的回应和改进措施，积极参与改进工作。"></el-checkbox>
                    <el-checkbox label="学生是否能够将反馈应用到学习过程中，提高自己的学习效果和体验。"></el-checkbox>
                </el-checkbox-group>
            </el-form-item>
            <div class="subBox address">
                <el-form-item>
                    <el-button  @click="goBack()">
                        取消
                    </el-button>
                    <el-button
                            type="primary"
                            @click="submitForm('ruleForm')"
                    >
                        提交
                    </el-button>
                </el-form-item>
            </div>
        </el-form>
        </fieldset>
    </div>
</div>
<script src="../../plugins/vue/vue.js"></script>
<!-- 引入组件库 -->
<script src="../../plugins/element-ui/index.js"></script>
<!-- 引入axios -->
<script src="../../plugins/axios/axios.min.js"></script>
<script src="../../js/request.js"></script>
<script src="../../api/student.js"></script>
<script src="../../js/validate.js"></script>
<script src="../../js/index.js"></script>
<script>
    new Vue({
        el: '#judge-app',
        data() {
            return {
                id: '',
                actionType : '',
                teacherId:'',
                teachingMethod:'',
                classroomInteraction:'',
                studentEvaluation:'',
                ruleForm : {
                    teachingCheckList:[],
                    classroomCheckList:[],
                    studentCheckList:[]
                }
            }
        },
        computed: {
            rules () {
                return {
                    teachingCheckList:[{required:true,trigger:'blur'}],
                    classroomCheckList:[{required:true,trigger:'blur'}],
                    studentCheckList:[{required:true,trigger:'blur'}]
                }
            }
        },
        created() {
            this.id = requestUrlParam('id')
            this.actionType = this.id ? 'edit' : 'add'
            if (this.id) {
                this.init()
            }
        },
        mounted() {
        },
        methods: {
            async init () {
                queryUserById(this.id).then(res => {
                    console.log(res)
                    if (String(res.code) === '1') {
                        console.log(res.data)
                        this.ruleForm = res.data
                    } else {
                        this.$message.error(res.msg || '操作失败')
                    }
                })
            },
            submitForm (formName) {
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                            const params = {
                                teacherId:this.id,
                                teachingMethod: this.ruleForm.teachingCheckList.length,
                                classroomInteraction: this.ruleForm.classroomCheckList.length,
                                studentEvaluation: this.ruleForm.studentCheckList.length
                            }
                        subStuJudge(params).then(res => {
                                if (res.code === 1) {
                                    this.$message.success('评价成功！')
                                    this.goBack()
                                } else {
                                    this.$message.error(res.msg || '操作失败')
                                }
                            }).catch(err => {
                                this.$message.error('请求出错了：' + err)
                            })
                    } else {
                        console.log('error submit!!')
                        return false
                    }
                })
            },
            goBack(){
                window.parent.menuHandle({
                    id: '2',
                    url: '/backend/page/student/judge.html',
                    name: '评价老师'
                },false)
            }
        }
    })
</script>
</body>
</html>